<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>系统登录</title>
<link rel="stylesheet" href="images/sycss.css" />
<link href="${ctx}/script/ligerUI/skins/Aqua/css/ligerui-all.css"
	rel="stylesheet" type="text/css" />
<script src="${ctx}/script/jquery/jquery-1.3.2.min.js"
	type="text/javascript"></script>
<script src="${ctx}/script/jquery-validation/jquery.validate.min.js"
	type="text/javascript"></script>
<script src="${ctx}/script/jquery-validation/jquery.metadata.js"
	type="text/javascript"></script>
<script src="${ctx}/script/jquery-validation/messages_cn.js"
	type="text/javascript"></script>
<script src="${ctx}/script/jquery/jquery.form.js" type="text/javascript"></script>
<script src="${ctx}/script/jquery.showLoading.min.js"
	type="text/javascript"></script>
<script src="${ctx}/script/error_exception_info.js"
	type="text/javascript"></script>
<script src="${ctx}/script/ligerUI/js/core/base.js"
	type="text/javascript"></script>
<script src="${ctx}/script/ligerUI/js/plugins/ligerDialog.js"
	type="text/javascript"></script>
<script src="${ctx}/script/json2.js" type="text/javascript"></script>

<script type="text/javascript">
var session='${session}';
var param='${param}';
$(function() {
	$("#USERNAME").addClass("required");
	$("#PASSWORD").addClass("required");
	
	$("#loginForm").validate({
		errorPlacement: function(error,element){
			$('#errorMsg').html('');
			error.appendTo($("#errorMsg")); 
		},
		submitHandler: function(form) {
			var options = { 
            		beforeSubmit:  showRequest,
                	success		:  showResponse, 
                    url			:  '${ctx}/plat/loginAction!login.action',
                   	type		:  "post",
                   	contentType	:  "application/x-www-form-urlencoded; charset=utf-8"
            }; 
        	
       		jQuery('#loadingArea').showLoading();	//	loading图片显示
           	$("#loginForm").ajaxSubmit(options);	//	异步提交表单
			return false;
		}
	});
	$("#USERNAME").focus();
});

/*	表单提交前处理函数      */
function showRequest(formData, jqForm, options) { 
    return true; 
} 

/*	提交完成后处理函数	 */
function showResponse(flag, statusText, xhr, $form){ 
	$('#errorMsg').html('');		
	if(statusText=='success'){
		if(flag==0){
			$('#errorMsg').html('账号不存在或者被禁用');
		}else if(flag==1){
			$('#errorMsg').html('密码错误');
		}else if(flag==2){
			$('#errorMsg').html('登录成功');
			location.href="${ctx}/plat/main.action";
			//跳转
		}
	}
	jQuery('#loadingArea').hideLoading();	//	移除loading效果
}

</script>
</head>
<body>
	<div id="login">
		<form id="loginForm" name="loginForm" method="post">
			<div class="d1">
				<input name="LOGINID" id="LOGINID" class="username"
					title="用户名不能为空! " />
			</div>
			<div class="d2">
				<input name="PASSWORD" id="PASSWORD" class="password"
					type="password" title="密码不能为空! " />
			</div>
			<div class="d9">
				<input name="saveLoginKey" type="checkbox" value="true" />&nbsp;&nbsp;记住密码
			</div>
			<div class="d10" id="errorMsg"></div>
			<div class="d5" id="loadingArea">
				<input type="submit" class="submit" value="" style="cursor: hand" />
				<input type="reset" class="reset" value="" style="cursor: hand" />
			</div>
		</form>
	</div>
</body>
</html>
